
package com.alex.insistence.rest.util;

import java.util.List;

import org.springframework.core.convert.converter.Converter;

import com.google.common.collect.Lists;

public class ConverterUtil {

  public static <S, T> List<T> convert(List<S> sources, Converter<S, T> converter) {
    if (sources == null) {
      return Lists.newArrayList();
    }

    List<T> dests = Lists.newArrayList();
    for (S source : sources) {
      dests.add(converter.convert(source));
    }
    return dests;
  }

}
